package com.px.controller;

import com.px.dao.UserDao;
import com.px.dto.ReturnResult;
import com.px.pojo.ShUser;

import com.px.vo.UserVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class ProviderUserController {
    @Resource
    private UserDao userDao;

    /**
     * 添加用户
     * @param user
     * @return
     * @throws Exception
     */

    @PostMapping("/provider/a")
    public boolean insertUser(@RequestBody ShUser user)throws Exception{
        Integer insert = userDao.insert(user);
        if (insert > 0){
            return true;
        }
        return false;
    }

    /**
     * 登录
     * @param account
     * @return
     * @throws Exception
     */
    @PostMapping("/provider/b")
    public ShUser getListMapUser(@RequestParam String account)throws Exception{
        return userDao.queryAccount(account);
    }

    @PostMapping("/provider/getUserById")
    public ShUser getUserById(Integer id)throws Exception{
        return userDao.queryById(id);
    }

}
